<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<jsp:directive.page import="com.anhry.app.safety.util.Util"/>
<%@ include file="/WEB-INF/pages/share/taglib.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
  <head>
    <base href="<%=basePath%>">
    <title>发送邮件</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">	
	<link href="<%=basePath+Util.SKIN%>/css/right.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=basePath%>/js/jquery-1.7.2.js"></script>
	<script type="text/javascript" src="<%=basePath%>/js/check_jquery.js"></script>
	<script src="<%=basePath%>/js/oa.js" type="text/javascript"></script>
   	<script type="text/javascript" src="<%=basePath%>/js/dbdialog/lhgdialog.min.js<%=Util.LHGDIALOG%>"></script>
	
	<style>
		li{float:left;list-style:none;height:25px;padding-top:3px;}
		.rname{float:left;width:99%;height:70px;border:1px #aaa solid;overflow:scroll;background:#fefefe;list-style:none;margin-top:3px;padding:5px;margin-left: 5px}
		.menuitem {float:left;POSITION: absolute; VISIBILITY: hidden;width:60%;}
		.menuitem1 {float:left;POSITION: static; VISIBILITY: visible;width:100%;}
	</style>
	<script type="text/javascript">
	
	/*
	window.onload = function(){
	//function openDialog(){
	   var mail_send = J('#btn1').dialog({id:'userlist', title:'收件人列表', width:800, height:520, cover:true, page:'<%=path%>/oa/mail_userList.action' });
	} 
	*/
$(document).ready(function(){
	$("#btn1").click(function() {
		infoDialog('选择收件人','800px','420px', '<%=basePath%>/oa/mail_userList.action');
	});

	if($("#isN").attr("checked")==true){
		$("#span1").addClass("menuitem1");
	}
	if($("#callSelect").val()==2 || $("#callSelect").val()==1){
		$("#span1").addClass("menuitem1");
	}
	$("#isN").click(function(){//短信提醒设置层(邮件发送)
	
		if($(this).attr("checked")=="checked"){
			$("#span1").addClass("menuitem1");
		}else{
			$("#span1").removeClass("menuitem1");
		}
	});
	$("#isRN0").click(function(){//短信提醒设置层（通知通告发送）
		$("#span1").removeClass("menuitem1");
		
	});
	$("#isRN1").click(function(){//短信提醒设置层（通知通告发送）		
		$("#span1").addClass("menuitem1");		
	});
	$("#callSelect").change(function(){//短信提醒设置层(系统提醒)
		if($(this).val()==2 || $(this).val()==1){
			$("#span1").addClass("menuitem1");
		}else{
			$("#span1").removeClass("menuitem1");
		}
	});
	
	$("#addMore").click(function(){//附件添加
		var td = document.getElementById("more");	
		var br = document.createElement("br");
		var input = document.createElement("input");
		var button = document.createElement("input");			
		input.type = "file";
		input.name = "myFile";
		input.size = "60";
		button.type = "button";
		button.value = "删除";	
		button.onclick = function(){
			td.removeChild(br);
			td.removeChild(input);
			td.removeChild(button);
		}			
		td.appendChild(br);
		td.appendChild(input);
		td.appendChild(button);	
	});
	$("#addMore1").click(function(){//附件添加
		var td = document.getElementById("more1");	
		var br = document.createElement("br");
		var input = document.createElement("input");
		var button = document.createElement("input");			
		input.type = "file";
		input.name = "otherFile";
		input.size = "60";
		button.type = "button";
		button.value = "删除";	
		button.onclick = function(){
			td.removeChild(br);
			td.removeChild(input);
			td.removeChild(button);
		}			
		td.appendChild(br);
		td.appendChild(input);
		td.appendChild(button);	
	});
	$("#noteCon").keyup(function(){//短信提醒内容字数验证
		
		if($(this).val().length<=100){
			$(this).next(".note4").html("你还可以写"+(100-$(this).val().length)+"字")
		}else{
			$(this).next(".note4").html("短信提示内容不能大于100字").addClass("note5");
			return false;
		}
	});
	
});
	
		//点击删除收件人
	function deleteChoose(id){
		var userIds = $("#addressee").val();
		$("#"+id).remove();
		
		var selectedIds = "";
		var ids = userIds.split(",");
		for(i=0;i<ids.length;i++){
	   		if(ids[i] != id){
				selectedIds += ids[i] + ",";
	   		}
		}
		selectedIds = selectedIds.substring(0, selectedIds.length-1);
		$("#addressee").val(selectedIds);
	}
	
	function toSend(method){
		if(method!=1){
			if($('#addressee').val()==null||$('#addressee').val()==""){
				msgDialog('请选择收件人！','i.png');
				//alert('请选择收件人！');
				return false;
			}
			if(document.mailForm.noteContent.value.length>100){
				msgDialog('短信提醒内容不能大于100字','i.png');
				//alert('短信提醒内容不能大于100字');
				return false;
			}
		}
		document.mailForm.isSubmit.value=method;
		//document.mailForm.submit();
		return true;
		
	}
	</script>
  </head>
  
  <body>
        <div class="body-box">
		<div class="map">
			<div class="map_con">
				您当前的位置：协同办公 &gt; 邮件管理 &gt; 写邮件
			</div>
		</div>
		<div id="container">
		    <form name="mailForm" action="<%=basePath%>/oa/mail_mailSendOrUpdate.action" method="post" enctype="multipart/form-data">
		    	<input type="hidden" name="addUser" value="" id="adduse">
		    	<input type="hidden" name="isSubmit" value="" id="isSubmit">
		    	<table border="0" cellspacing="0" cellpadding="0"  width="100%" class="info_table">
					<tr>
						<td colspan="2" class="title_li">新邮件</td>
					</tr>
					<tr>
						<td width="100" class="title_td">收件人：</td>
						<td style="padding-bottom:3px;">
							<li><input type="button" name="bt1" value="选 择" id="btn1" class="link_input"/>	</li>
							<span id="addresseeNames" class="rname">	
								<span id="${user.id}">${user.userRealName}<img src="<%=basePath%>/images/delete.gif" id="${user.id }" name="${user.id }" onclick="deleteChoose('${user.id }');"/> </span>
							</span>	
							<input type="hidden" name="addressee" id="addressee" value="${addressee }">
						</td>
					</tr>
					<tr>
						<td class="title_td">主题：</td>
						<td ><input name="mailTitle" type="text" size="70%" id="bit1" value="Re:${mail.mailTitle }" ><span class="note4">*</span></td>
					</tr>				
					<tr>
						<td class="title_td">附件：</td>
						<td id="more"><input type="button" name="am1" value="添加附件" id="addMore" class="link_input"/> </td>
					</tr>
<%--					<tr>	--%>
<%--						<td class="title_td">内容：</td>--%>
<%--						<td >--%>
<%--							<FCK:editor instanceName="mailContent" width="99%" height="300" toolbarSet="Basic">--%>
<%--								<jsp:attribute name="value"></jsp:attribute>--%>
<%--								<jsp:body><FCK:config id="cmbSkins" SkinPath="skins/office2003/" /></jsp:body>--%>
<%--					        </FCK:editor>--%>
<%--						</td>--%>
<%--					</tr>--%>
					<tr>	
						<td class="title_td">内容：</td>
						<td >
							<textarea name="mailContent" style="display:none"></textarea>
							<div style="margin-left: 5px">
								<iframe id="eWebEditor1" src="<%=Util.EDITOR_BASE_URL %>/ewebeditor/ewebeditor.htm?id=mailContent&style=standard600&skin=office2003" frameborder="0" scrolling="no" width="600" height="350"></iframe>
							</div> 
						</td>
					</tr>
					<tr>
						<td class="title_td"></td>
						<td>
							<input type="checkbox" name="isExigence" value="1" id="isE"/><label for="isE">紧急</label>
							<input type="checkbox" name="isReturn" value="1" id="isT"/><label for="isT">已读回执</label>
							<input type="checkbox" name="isNote" value="1" id="isN"/><label for="isN">短信提醒</label>
							<div id="span1" class="menuitem">启动时间（接收后多久未读）<input type="text" name="noteDay" value="0" size="1" id="bnumber1"/><span class="note4"></span> 天 <input type="text" name="noteHour" value="0" size="1" id="bnumber2"/><span class="note4"></span>小时<input type="text" name="noteSec" value="0" size="1" id="bnumber3"/><span class="note4"></span>分钟&nbsp;&nbsp;(注：如无间隔时间，请全部填写为"0")
							<br/>提醒内容：<textarea rows="3" cols="50" name="noteContent" id="noteCon"></textarea><label id="wordNum" class="note4">字数不能超过100字</label>
							</div>						
						</td>
					</tr>				
				</table>
				<table border="0" cellspacing="0" cellpadding="0"  width="100%" style="float:left; padding-top:15px;padding-bottom:5px;">
					<tr>
						<td align="center"><input type="submit" id="btnSubmit1" class="link_input" value="发 送" onclick="return toSend('0')"/><input name="bn1" type="submit" id="btnSubmit2" value="存草稿" class="link_input" id="cg1" onclick="return toSend('1')"/></td>
					</tr>
				</table>
		    </form>
		    <!-- 
			</div>
			    <div class="right_bottom">
					<div style="width:11px;float:left"><img src="<%=basePath%>/images/right_bottom.gif"/></div>
					<div style="width:16px;float:right"><img src="<%=basePath%>/images/right_rbottom.gif"/></div>
				</div>
			</div>
			 -->
  </body>
</html>
